package com.ar4j.bench.test.synthetic;

/**
 * API that defines the requires methods for all callback implementation provided to the SyntheticCrudBenchmark utility.
 */
public interface SyntheticCrudBenchmarkCallbacks<T> {
  
  /**
   * Called before a benchmark begins
   */
  void prepare();
  
  /**
   * Generates a single test object
   */
  T generate();
  
  /**
   * Adds a test object to the backing store
   */
  Long add(T obj);
  
  /**
   * Retrieves an object from the backing store by its ID
   */
  T findById(Long id);
  
  /**
   * Randomizes the fields of the given test object. Foreign keys should not be randomized.
   */
  void randomize(T obj);
  
  /**
   * Updates the given object in the backing store
   */
  void update(T obj);
  
  /**
   * Removes the given object from the backing store
   */
  void removeById(Long id);
  
  /**
   * Called after the test, allowing for cleanup.
   */
  void cleanup();
  
  
}